package com.zf.service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.stereotype.Service;

import com.zf.dao.domain.MockInfoDao;

@Service
public class MockInfoService {
	
	public MockInfoDao getMockInfoDao(String url, String requestMethod){
		for (MockInfoDao mockInfoDao : DataProviderService.MOCK_INFOS) {
			List<String> methods = new ArrayList<String>(Arrays.asList(mockInfoDao.getRequestMethod().split("\\,")));
			if(url.equals(mockInfoDao.getRequestUrl()) && methods.contains(requestMethod)){
				return mockInfoDao;
			}
		}
		return null;
	}
	
}
